<template>
	<div>
		{{test()}}
	</div>
</template>

<script>
	let testdata = {
		"type": "gongshi",
		"fun": "Util.Chu",
		"name": "除法",
		"fengefu": "÷",
		"isVariablecanshu": false,
		"parameter": [{
				"type": "gongshi",
				"parameter": [{
						"type": "value",
						"parameter": "sheet1#D6",
						"name": "阿"
					},
					{
						"type": "value",
						"parameter": "sheet2#C4",
						"name": "才"
					}
				],
				"fun": "Util.Cheng",
				"name": "乘法",
				"fengefu": "*",
				"isVariablecanshu": false
			},
			{
				"type": "gongshi",
				"parameter": [{
						"type": "value",
						"parameter": "sheet1#D6",
						"name": "阿"
					},
					{
						"type": "gongshi",
						"parameter": [{
								"type": "value",
								"parameter": "sheet1#D6",
								"limit": "shuju",
								"name": "阿"
							},
							{
								"type": "value",
								"parameter": "sheet2#C4",
								"limit": "shuju",
								"name": "才"
							}
						],
						"fun": "Util.Sum",
						"name": "求和",
						"fengefu": ":",
						"qianzhui": "SUM",
						"isVariablecanshu": false
					}
				],
				"fun": "Util.Jia",
				"name": "加法",
				"fengefu": "+",
				"isVariablecanshu": false
			}
		]
	}


	let ToStringFun = function(gongshi) {
		if (gongshi.type == "null") {
			return null
		}
		if (gongshi.type == "value") {
			return '"' + gongshi.parameter + '"'
		}
		let str = gongshi.fun + "([";
		//中间再加参数
		for (let index in gongshi.parameter) {
			let sub = gongshi.parameter[index];
			str += ToStringFun(sub)
			//如果是最后一个不加
			if (index != gongshi.parameter.length - 1) {
				str += ","
			}

		}
		str += "])"
		return str
	}


	export default {
		name: "mapTitle",
		components: {},
		props: {},
		data() {
			return {

			}
		},
		created() {

		},
		mounted() {

		},
		methods: {
			test() {
				return "=" + ToStringFun(testdata)
			}
		},
		computed: {},
		watch: {}
	}
</script>

<style>
</style>
